package LeetCode;

import java.util.ArrayList;
import java.util.List;

public class LC_535_EncodeandDecodeTinyURL {

    public static void main(String[] args) {

    }

    public class Codec {
        List<String> urls = new ArrayList<>();

        public String encode(String longUrl) {
            urls.add(longUrl);
            return String.valueOf(urls.size() - 1);
        }

        public String decode(String shortUrl) {
            int index = Integer.valueOf(shortUrl);
            return index < urls.size() ? urls.get(index) : "";
        }

    }
}